package com.app.reportproblem.Utils;

import android.content.Context;
import android.content.SharedPreferences;

public class PreferenceHelper {
	private SharedPreferences sharedPreferences;
	public static final String PREFERENCE_FILE = "preference_file.com.reportapp";

	public static final String EMAIL = "email";
	public static final String PASS = "pass";

	public static final String USER_ID = "user_id";

	public static final String LAT = "lat";
	public static final String LON = "lon";

	public static final String ACCESS_TOKEN = "access_token";

	public static final String NAME = "name";
	public static final String MOBILE = "name";

	public static final String FIXED = "fixed";

	public static final String URL_ACTIONBAR = "url_actionbar";

	public PreferenceHelper(Context context) {
		this.sharedPreferences = context.getSharedPreferences("report", 0);
	}

	public String getUrlActionBar() {
		return this.sharedPreferences.getString(URL_ACTIONBAR, "");
	}

	public int getUserFixed() {
		return this.sharedPreferences.getInt(FIXED, -1);
	}

	public String getName() {
		return this.sharedPreferences.getString(NAME, "");
	}

	public String getMobile() {
		return this.sharedPreferences.getString(MOBILE, "");
	}

	public String getAccessToken() {
		return this.sharedPreferences.getString(ACCESS_TOKEN, "");
	}

	public long getLAT() {
		return this.sharedPreferences.getLong(LAT, -1);
	}

	public long getLON() {
		return this.sharedPreferences.getLong(LON, -1);
	}

	public int getUserId() {
		return this.sharedPreferences.getInt(USER_ID, 0);
	}

	public String getEmail() {
		return this.sharedPreferences.getString(EMAIL, "");
	}

	public String getPass() {
		return this.sharedPreferences.getString(PASS, "");
	}

	public void setEmail(String value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putString(EMAIL, value);
		localEditor.commit();
	}

	public void setPass(String value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putString(PASS, value);
		localEditor.commit();
	}

	public void setUserId(int value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putInt(USER_ID, value);
		localEditor.commit();
	}

	public void setLAT(long value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putLong(LAT, value);
		localEditor.commit();
	}

	public void setLON(long value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putLong(LON, value);
		localEditor.commit();
	}

	public void setAccessToken(String value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putString(ACCESS_TOKEN, value);
		localEditor.commit();
	}

	public void setName(String value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putString(NAME, value);
		localEditor.commit();
	}

	public void setMobile(String value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putString(MOBILE, value);
		localEditor.commit();
	}

	public void setFixed(int value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putInt(FIXED, value);
		localEditor.commit();
	}

	public void setUrlActionbar(String value) {
		SharedPreferences.Editor localEditor = this.sharedPreferences.edit();
		localEditor.putString(URL_ACTIONBAR, value);
		localEditor.commit();
	}

}
